package Controller;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

import java.io.IOException;
public class Main extends Application {
    private static Stage stage;
    public static void main(String[] args) {
        launch(args);
    }
    public class SharedData {
        public static int isAdmin;
    }
    @Override
    public void start(Stage stage) throws IOException {
        Main.stage = stage;
        stage.setTitle("教室管理系统");
        changeView("login-view.fxml");
        stage.show();
    }

    public static void changeView(String fxml) {
        Parent parent = null;
        try {
            parent = FXMLLoader.load(Main.class.getResource(fxml));
            stage.setScene(new Scene(parent));
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public static void addView(String fxml) {
        Stage stage = new Stage();
        Parent parent = null;
        try {
            parent = FXMLLoader.load(Main.class.getResource(fxml));
            stage.setScene(new Scene(parent));
        } catch (IOException e) {
            e.printStackTrace();
        }
        stage.show();
    }

}